package com.highgain.displacementtrend.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.highgain.displacementtrend.entity.AlarmLog;
import com.highgain.displacementtrend.mapper.AlarmLogMapper;
import com.highgain.displacementtrend.service.AlarmLogService;
import com.highgain.displacementtrend.util.PageView;
import org.springframework.stereotype.Service;

/**
 * @author zhanglifeng
 * @date 2021/04/15 15:53
 **/
@Service
public class AlarmLogServiceImpl extends ServiceImpl<AlarmLogMapper, AlarmLog> implements AlarmLogService {

    @Override
    public PageView<AlarmLog> queryAlarmLog(PageView<AlarmLog> pageView, AlarmLog alarmLog) {
        Page<AlarmLog> page = new Page<>(pageView.getPageNow(), pageView.getPageSize());
        IPage<AlarmLog> alarmLogIPage = baseMapper.queryAlarmLog(page, alarmLog);
        pageView.setRowCount(((int) alarmLogIPage.getTotal()));
        pageView.setRecords(alarmLogIPage.getRecords());
        return pageView;
    }
}
